import request from '@/utils/request'

/**
 * 获取城市列表数据
 * @returns
 */
export const getCityList = () => {
  return async (dispatch) => {
    const res = await request('/area/city?level=1')
    // console.log(res)
    dispatch({
      type: 'CITY_LIST',
      payload: res.data.body,
    })
  }
}

/**
 * 获取热门城市数据
 * @returns
 */
export const getHotCity = () => {
  return async (dispatch) => {
    const res = await request.get('/area/hot')
    // console.log(res)
    dispatch({
      type: 'HOT_CITY',
      payload: res.data.body,
    })
  }
}
